package abstractEntities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;

import entities.Coursestudent;
import entities.Languagecourse;
import entities.Lesson;
import entities.Mastercoach;

/**
 * AbstractCourse entity provides the base persistence definition of the Course
 * entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractCourse implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 8855345839453854142L;
	private Integer idCourse;
	private Mastercoach mastercoach;
	private Set<Lesson> lessons = new HashSet<Lesson>(0);
	private Set<Coursestudent> coursestudents = new HashSet<Coursestudent>(0);
	private Set<Languagecourse> languagecourses = new HashSet<Languagecourse>(0);

	// Constructors

	/** default constructor */
	public AbstractCourse() {
	}

	/** minimal constructor */
	public AbstractCourse(Mastercoach mastercoach) {
		this.mastercoach = mastercoach;
	}

	/** full constructor */
	public AbstractCourse(Mastercoach mastercoach, Set<Lesson> lessons,
			Set<Coursestudent> coursestudents,
			Set<Languagecourse> languagecourses) {
		this.mastercoach = mastercoach;
		this.lessons = lessons;
		this.coursestudents = coursestudents;
		this.languagecourses = languagecourses;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idCourse", unique = true, nullable = false)
	public Integer getIdCourse() {
		return this.idCourse;
	}

	public void setIdCourse(Integer idCourse) {
		this.idCourse = idCourse;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idMaster", nullable = false)
	public Mastercoach getMastercoach() {
		return this.mastercoach;
	}

	public void setMastercoach(Mastercoach mastercoach) {
		this.mastercoach = mastercoach;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "course")
	public Set<Lesson> getLessons() {
		return this.lessons;
	}

	public void setLessons(Set<Lesson> lessons) {
		this.lessons = lessons;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "course")
	public Set<Coursestudent> getCoursestudents() {
		return this.coursestudents;
	}

	public void setCoursestudents(Set<Coursestudent> coursestudents) {
		this.coursestudents = coursestudents;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "course")
	public Set<Languagecourse> getLanguagecourses() {
		return this.languagecourses;
	}

	public void setLanguagecourses(Set<Languagecourse> languagecourses) {
		this.languagecourses = languagecourses;
	}

}